﻿using System;
using System.Windows;
using ICSharpCode.SharpZipLib.Zip;
namespace QDP.Platform.Loader
{
    public class ZipAssemblyParser:IParser
    {
        public void Parse(string file,System.IO.Stream stream)
        {
            D.Debug("压缩程序集");
            using (ZipInputStream s = new ZipInputStream(stream))
            {
                ZipEntry theEntry;
                try
                {
                    while ((theEntry = s.GetNextEntry()) != null)
                    {
                        byte[] bs = new byte[theEntry.Size];
                        s.Read(bs, 0, bs.Length);
                        var assembly = new AssemblyPart().Load(new System.IO.MemoryStream(bs));
                    }
                }
                catch (Exception ex)
                {
                    D.Debug("err:" + ex.Message + " file:" + file);
#if DEBUG
                    MessageBox.Show(file + "\r\n" + ex.Message);
#endif
                }
            }
        }
    }
}
